﻿@typeparam TValue
@inherits SelectInputBase<TValue>

<div>
@if (!string.IsNullOrEmpty(UseLabel))
{
    <label for=@Id class="block text-sm font-medium text-gray-700">@UseLabel</label>
}
    <select id=@Id name=@Id class=@ClassNames("mt-1 block w-full pl-3 pr-10 py-2 text-base focus:outline-none border-gray-300 sm:text-sm rounded-md", 
        CssClass(valid:"text-gray-900 focus:ring-indigo-500 focus:border-indigo-500",
               invalid:"text-red-900 focus:ring-red-500 focus:border-red-500")) 
            @bind="CurrentValue" @attributes="IncludeAttributes">
            @ChildContent
    @foreach (var kvp in KvpValues())
    {
        <option @key=@kvp.Key value=@kvp.Key>@kvp.Value</option>
    }
    </select>
    @if (HasErrorField)
    {
        <p class="mt-2 text-sm text-red-500" id=@($"{Id}-error")>@ErrorFieldMessage</p>
    }
</div>
